package com.xxxx.spring.event;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class Comment1 {

    @Autowired
    private ApplicationEventPublisher publisher;

    public void pubilsh(){
        log.info("给用户发信息");
        publisher.publishEvent(new MessageEvent(this));
    }
}
